<template>
  <div class="flip-card-container">

    <div class="flip-card">
      <div class="switch-holder">
        <div class="switch-label">
          <i class="fa fa-bluetooth-b"></i><span>Sign</span>
        </div>
        <div class="switch-toggle">
          <input type="checkbox" id="Sign" v-model="loginShow">
          <label for="Sign"></label>
        </div>
      </div>
      <div class="middle" :class="{ 'rotateY180' : loginShow }">
        <div id="login-box" class="card-front" v-show="!loginShow">
          <div class="input-box">
            <input type="text" placeholder="手机号/邮箱" />
          </div>
          <div class="input-box">
            <input type="password" placeholder="密码" />
          </div>
          <div class="input-box yzm">
            <input type="text" placeholder="验证码" />
            <img src="" alt="验证码">
          </div>
          <button>Sign in</button>
          <p class="forget">登录方式 <img src="@/assets/img/vw.svg" alt="登录方式"> </p>
          <p class="forget">忘记密码?</p>
        </div>
        <div id="register-box" class="card-back" v-show="loginShow">
          <div class="input-box">
            <input type="text" placeholder="用户名" />
          </div>
          <div class="input-box">
            <input type="text" placeholder="手机号/邮箱" />
          </div>
          <div class="input-box">
            <input type="password" placeholder="密码" />
          </div>
          <div class="input-box">
            <input type="password" placeholder="重复密码" />
          </div>
          <div class="input-box yzm">
            <input type="text" placeholder="验证码" />
            <img src="" alt="验证码">
          </div>
          <button>Sign up</button>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'

const loginShow = ref(false);


</script>

<style lang="scss" scoped>


.flip-card-container {
  perspective: 1000px;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.middle {
  width: 100%;
  // overflow: visible;
  transform-style: preserve-3d;
  transition: all .6s;
}
#login-box,
#register-box {
  text-align: center;
  padding: 40px;
  position: relative;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  margin: auto;
}

.flip-card {
  width: 350px;
  // height: 500px;
  // position: relative;
  border-radius: 13px;
  overflow: hidden;
  background-color: rgba($color: #000000, $alpha: 0.4);
}

.rotateY180 {
  transform: rotateY(180deg) !important
}

.card-front {
  transform: rotateY(0deg);
  z-index: 2;
}
.card-back {
  transform: rotateY(180deg);
  z-index: 1;
}

#login-box h1 {
  color: #ffffff;
}

.middle .input-box {
  margin-top: 30px;
}

.middle .input-box input {
  width: 100%;
  background: none;
  border: none;
  border-bottom: #FFFFFF 2px solid;
  padding: 5px 10px;
  outline: none;
  color: #FFFFFF;
  letter-spacing: 1px;

}

.middle .input-box input::placeholder {
  color: #fff;
}

.middle button {
  line-height: 26px;
  margin-top: 30px;
  margin-bottom: 20px;
  outline: none;
  border: none;
  height: 34px;
  --width: 130px;
  --timing: 2s;
  border: 0;
  width: var(--width);
  color: #fff;
  font-weight: bold;
  font-size: 1em;
  background: rgb(64, 192, 87);
  transition: all 0.2s;
  border-radius: 3px;
}

.middle button:hover {
  background-image: linear-gradient(to right, rgb(250, 82, 82), rgb(250, 82, 82) 16.65%, rgb(190, 75, 219) 16.65%, rgb(190, 75, 219) 33.3%, rgb(76, 110, 245) 33.3%, rgb(76, 110, 245) 49.95%, rgb(64, 192, 87) 49.95%, rgb(64, 192, 87) 66.6%, rgb(250, 176, 5) 66.6%, rgb(250, 176, 5) 83.25%, rgb(253, 126, 20) 83.25%, rgb(253, 126, 20) 100%, rgb(250, 82, 82) 100%);
  animation: var(--timing) linear dance6123 infinite;
  transform: scale(1.1) translateY(-1px);
}

@keyframes dance6123 {
  to {
    background-position: var(--width);
  }
}

.middle .input-box i {
  color: #FFFFFF;
}

.forget {
  font-size: 12px;
  margin-top: 6px;
  color: #fff;
  letter-spacing: 1px;
  text-align: left;
}

.forget a {
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.yzm {
  display: flex;
  justify-content: space-between;
  align-items: center;

  img {
    width: 130px;
    margin-left: 15px;
  }
}
.switch-holder {
  display: flex;
  padding: 10px 20px;
  border-radius: 10px;
  box-shadow: -6px -6px 12px rgba(255, 255, 255, .7),
        10px 10px 10px rgba(0, 0, 0, .2),
        inset 8px 8px 15px rgba(255, 255, 255, .7),
        inset 10px 10px 10px rgba(0, 0, 0, .2);
  justify-content: space-between;
  align-items: center;
}

.switch-label {
  padding: 0 20px 0 10px
}

.switch-label i {
  margin-right: 5px;
}

.switch-toggle {
  height: 40px;
}

.switch-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  z-index: -2;
}

.switch-toggle input[type="checkbox"]+label {
  position: relative;
  display: inline-block;
  width: 100px;
  height: 40px;
  border-radius: 20px;
  margin: 0;
  cursor: pointer;
  box-shadow: inset -8px -8px 15px rgba(255, 255, 255, .6),
        inset 10px 10px 10px rgba(0, 0, 0, .25);
}

.switch-toggle input[type="checkbox"]+label::before {
  position: absolute;
  content: 'IN';
  font-size: 13px;
  text-align: center;
  line-height: 25px;
  top: 8px;
  left: 8px;
  width: 45px;
  height: 25px;
  border-radius: 20px;
  color: #000;
  background-color: #fff;
  box-shadow: -3px -3px 5px rgba(255, 255, 255, .5),
        3px 3px 5px rgba(0, 0, 0, .25);
  transition: .3s ease-in-out;
}

.switch-toggle input[type="checkbox"]:checked+label::before {
  left: 50%;
  content: 'UP';
  color: #fff;
  background-color: #00b33c;
  box-shadow: -3px -3px 5px rgba(255, 255, 255, .5),
        3px 3px 5px #00b33c;
}

</style>
